package com.thoughtworks.preuniversity.biblioteca;

/**
 * Created by padmavb on 6/12/14.
 */
//Job:Reads the book title which the customer want to checkOut ,ask for library whether it is in the available book list or not.
public class CheckOutBookMovie extends MenuOperation{

     String jobOfClass;
    public CheckOutBookMovie(String jobOfClass){
        this.jobOfClass=jobOfClass;
    }

    @Override
    void doCorrespondingOperation(Library library) {

        UserInterface userInterface=new UserInterface();

        if(this.jobOfClass.equals("Check Out Book")){

            userInterface.displayMessage("Enter book title to check out");

            String bookToCheckOut=userInterface.readBookTitle();
            library.checkOutBook(bookToCheckOut);
        }
        else{

            userInterface.displayMessage("Enter movie name to check out");

            String movieToCheckOut=userInterface.readMovieTitle();
            library.checkOutMovie(movieToCheckOut);

        }

    }

    @Override
    String giveJobOfClass() {
        return jobOfClass;
    }
}
